import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {

	public static void main(String[] args) {
		try {
			ServerSocket sSocket = new ServerSocket(32146);
			MrMonitor mon = new MrMonitor();
			Sender sender = new Sender(mon);
			sender.start();
			while (true) {
				Socket sock = sSocket.accept();
				User u = new User(mon, sock, sender);
				sender.addUser(u);
				u.start();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
